const log4js = require("koa-log4");
const log4jsConf  =  {
    appenders: {
      console: {
        type: "console",
      },
      errors: {
        type: "dateFile",
        filename: "logs/errors.log",
        // alwaysIncludePattern: true, // 代表在最新的一个日志文件里追加日志(默认是在errors.log文件写入内容)
        daysToKeep: 0, // 大于0则会删除x天之前的日志
        pattern: "-yyyy-MM-dd", // yyyy-MM-dd-hh-mm=>每分钟切割一次 yyyy-mm-dd-hh =>每小时
        keepFileExt: true,
      },
    },
    categories: {
      default: {
        appenders: ["console"],
        level: "all",
      },
      errors: {
        appenders: ["errors"],
        level: "error",
      },
    },
  };
log4js.configure(log4jsConf);
 const errLogger = log4js.getLogger("errors");
 module.exports={
    errLogger
}